import httpx
import asyncio

headers={
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.62'
}
proxies = {
    "http://": "http://localhost:7890",
    "https://": "http://localhost:7890",
}
async def spider(num):
    print('启动',num)
    async with httpx.AsyncClient(http2=True,proxies=proxies) as client:
        html=await client.get('https://www.python-httpx.org/',headers=headers)
        print(html)

async def main():
    await asyncio.gather(*[spider(1),spider(2),spider(3)])


if __name__ == '__main__':
    asyncio.run(main())